#include <iostream>
#include <string>
#include <vector>
using namespace std;

class Sceen{
	public:
		int f(){return 0;}
};

class Sales_item{
	public:
		Sales_item():units_sold(0),revenue(0.0){}
		Sales_item(const string&);
		Sales_item(const Sales_item&);
		~Sales_item(){}
		Sales_item& operator=(const Sales_item&);
		Sales_item& operator+=(const Sales_item&);
		Sales_item operator+(const Sales_item&);
		friend istream& operator>>(istream&,Sales_item&);
		friend ostream& operator<<(ostream&,const Sales_item&);		
		friend  int Sceen::f();
	private:
		string isbn;
		unsigned units_sold;
		double revenue;
};

class Foo{
	public:
		Sales_item& operator[](const size_t);
	private:
		vector<Sales_item> data;
};

Sales_item& Foo::operator[](const size_t index){
	return data[index];
}

Sales_item::Sales_item(const string &book):isbn(book),units_sold(0),revenue(0.0){
}

Sales_item::Sales_item(const Sales_item& orig):isbn(orig.isbn),units_sold(orig.units_sold),revenue(orig.revenue)
{}

Sales_item & Sales_item::operator=(const Sales_item& rhs){
	isbn = rhs.isbn;
	units_sold = rhs.units_sold;
	revenue = rhs.revenue;
	return *this;
}

ostream& operator<<(ostream &out, const Sales_item& s){
	out << s.isbn << "\t" << s.units_sold << "\t" 
	      << s.revenue;
	return out;
}

Sales_item & Sales_item::operator+=(const Sales_item& s){
	units_sold += s.units_sold;
	revenue += s.revenue;
	return *this;
}

Sales_item Sales_item::operator+(const Sales_item& s){
	Sales_item ret(*this);
	ret += s;
	return ret;
}

istream& operator>>(istream& in, Sales_item &s){
	double price;
	in >> s.isbn >> s.units_sold >> price;
	if(in)
		s.revenue = s.units_sold * price;
	else
		s = Sales_item();
	return in;
}

int main(){
	Sales_item item1("Hello");
	Sales_item item2(item1);
	Sales_item item3;
	Sales_item item4;
	cin >> item4;
	item3 = item4;
	item3 += item4;
	item2 = item3 + item4;
	cout << "item1:" << item1 << endl;
	cout << "item2:" << item2 << endl;
	cout << "item3:" << item3 << endl;
	cout << "item4:" << item4 << endl;
	return 0;
}
